package com.example.dao;

import com.example.pojo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface QyMapper {

    //各区域数量
    @Select("select name,max(shulian) as shulian from qy1 GROUP BY name LIMIT 7;")
    List<Qy> selectQy();

    //总户型分布
    @Select("select hx,max(shulian) as shulian from hx GROUP BY hx ORDER BY  shulian DESC  LIMIT 6;")
    List<Hx> selectHx();

    //出售数量前10的小区
    @Select("select name,max(shulian) as shulian from fname  GROUP BY name ORDER BY  shulian DESC  LIMIT 10")
    List<Fname> selectFSQ();

    //单价前10的小区
    @Select("SELECT DISTINCT `name` ,shulian FROM `djq` ORDER BY shulian DESC LIMIT 10;")
    List<Fdj> selectFDJ();


    //各区户型分布
    @Select("SELECT hx,max(shulian) as shulian from qhxfb  WHERE `name`=\"云岩区\" AND (hx=\"3室2厅\" or hx=\"3室1厅\" or hx=\"2室2厅\" or hx=\"2室1厅\") GROUP BY name,hx ;\n")
    List<Hx> selectFQHx1();

    @Select("SELECT name,hx,max(shulian) as shulian from qhxfb  WHERE `name`=\"花溪区\" AND (hx=\"3室2厅\" or hx=\"3室1厅\" or hx=\"2室2厅\" or hx=\"2室1厅\") GROUP BY name,hx ;")
    List<Hx> selectFQHx2();

    @Select("SELECT name,hx,max(shulian) as shulian from qhxfb  WHERE `name`=\"南明区\" AND (hx=\"3室2厅\" or hx=\"3室1厅\" or hx=\"2室2厅\" or hx=\"2室1厅\") GROUP BY name,hx ;")
    List<Hx> selectFQHx3();

    @Select("SELECT name,hx,max(shulian) as shulian from qhxfb  WHERE `name`=\"观山湖区\" AND (hx=\"3室2厅\" or hx=\"3室1厅\" or hx=\"2室2厅\" or hx=\"2室1厅\") GROUP BY name,hx ;")
    List<Hx> selectFQHx4();

    @Select("SELECT name,hx,max(shulian) as shulian from qhxfb  WHERE `name`=\"白云区\" AND (hx=\"3室2厅\" or hx=\"3室1厅\" or hx=\"2室2厅\" or hx=\"2室1厅\") GROUP BY name,hx ;")
    List<Hx> selectFQHx5();

    @Select("SELECT name,hx,max(shulian) as shulian from qhxfb  WHERE `name`=\"乌当区\" AND (hx=\"3室2厅\" or hx=\"3室1厅\" or hx=\"2室2厅\" or hx=\"2室1厅\") GROUP BY name,hx ;")
    List<Hx> selectFQHx6();


    //信息轮播
    @Select("select * from fy")
    List<Fy> selectFy();

    //各区单价
    @Select("select name,dj from fqdj WHERE name=\"观山湖区\"and shulian=1718 or name=\"南明区\"and shulian=1609 or name=\"云岩区\"and shulian=1559\n" +
            "or name=\"白云区\"\tand shulian=850 OR\n" +
            "name=\"花溪区\"\tand shulian=675\n" +
            "or name=\"乌当区\"\tand shulian=133\n" +
            "or name=\"清镇市\" and shulian =33 ORDER BY dj desc;")
    List<Fd> selectFQDJ();

}
